package com.chat.datea.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.chat.datea.base.Finnal_Base;
import com.chat.datea.fragment.AlbumListFragment;
import com.chat.datea.fragment.GuessSingerMusicFragment;

import java.util.ArrayList;

/**
 * Created by dllo on 15/10/22.
 */
public class GuessSingerFragment_ViewPager_Adapter extends FragmentPagerAdapter {
    private ArrayList<Fragment> fragments;
    private String[] title = {"歌曲", "专辑"};
    private String songListUrl = null;
    private String ting_uid;
    private String Albums;

    public GuessSingerFragment_ViewPager_Adapter(FragmentManager fm,
                                                 String ting_uid,String artist_id,String Albums) {
        super(fm);
        this.Albums = Albums;
        this.ting_uid = ting_uid;
        songListUrl = Finnal_Base.userRecOnClickOne + ting_uid + Finnal_Base.artistid + artist_id
                + Finnal_Base.offset + "0" + Finnal_Base.userRecOnClickFour;
        initFragment();
    }

    private void initFragment() {
        fragments = new ArrayList<>();
        fragments.add(new GuessSingerMusicFragment(songListUrl));
        fragments.add(new AlbumListFragment(ting_uid,Albums));
    }

    @Override
    public Fragment getItem(int position) {

        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return title.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return title[position];
    }

}
